package com.ross.mode.entity;

/**
 * @version 1.0.0
 * @className: Student
 * @description:
 * @author: zhangjunfa
 * @date: 2023/4/3 10:39
 */
public class Student {
    private String id;
    private String name;
    private String classId;
    private Integer age;

    /**
     * 私有构造器
     *
     * @param builder
     */
    private Student(Builder builder) {
        this.id = builder.id;
        this.name = builder.name;
        this.classId = builder.classId;
        this.age = builder.age;
    }

    /**
     * 建造者模式
     */
    public static final class Builder {
        private String id;
        private String name;
        private String classId;
        private Integer age;

        public Builder id(String id) {
            this.id = id;
            return this;
        }

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder classId(String classId) {
            this.classId = classId;
            return this;
        }

        public Builder age(Integer age) {
            this.age = age;
            return this;
        }

        public Student build() {
            return new Student(this);
        }

    }
}
